package com.ls.fw.mongo.dao;

import java.util.Map;

import org.bson.conversions.Bson;

import com.ls.fw.data.bean.PageList;


/**
 * 底层数据访问业务
 * @author ls
 */
public interface DataDao {

	
	public MongoDbClient getMongoDbClient();
	
	/**
	 * 查询
	 * @param table
	 * @param para
	 * @param page
	 * @param pageSize
	 * @param orderField
	 * @param order
	 * @return
	 * @throws Exception
	 */
	PageList<Map<String, Object>> query(String schmal,String table,Map<String, String> para, int page, int pageSize,
			String orderField, int order) throws Exception;

	/**
	 * 添加数据
	 * @param table
	 * @param map
	 * @throws Exception
	 */
	void add(String schmal,String table,Map<String, Object> map) throws Exception;

	/**
	 * 修改数据
	 * @param table
	 * @param map
	 * @param id
	 * @throws Exception
	 */
	void update(String schmal,String table,Map<String, Object> map, String id) throws Exception;

	/**
	 * 删除数据
	 * @param table
	 * @param id
	 * @return
	 */
	long delete(String schmal,String table, String... id);

	/**
	 * 保存数据
	 * @param table
	 * @param model
	 * @throws Exception
	 */
    void persist(String schmal,String table,Map<String,Object> model) throws Exception;

    
    /**
     * 查看数据
     * @param table
     * @param id
     * @return
     * @throws Exception
     */
	Map<String, Object> find(String schmal,String table, String id) throws Exception;


	/**
	 * 清空
	 * @param table
	 */
	void empty(String schmal,String table);

	PageList<Map<String, Object>> query(String schmal, String table, Bson filter, int page, int pageSize,
			String orderField, int order);
	
}
